package com.luozhili.AWT;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

public class Start3 {
    public static void main(String[] args) {
        Frame frame = new Frame();
        frame.setBounds(1200, 250, 300, 400);

        //设置布局方式
        frame.setLayout(new FlowLayout());
        //设置按钮
        // awt的button对中文支持不好。。使用swing的按钮
//         Button button = new Button("我是按钮");
        JButton button = new JButton("好嗨哟");
        frame.add(button);



        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                System.exit(0);
            }
        });
        button.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                System.out.println("感觉人生到达了巅峰");
            }
        });


        frame.setVisible(true);



    }
}
